'use strict'

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    const { STRING, TEXT, INTEGER, DATE, BOOLEAN } = Sequelize
    await queryInterface.createTable('works', {
      id: {
        type: INTEGER(20).UNSIGNED,
        primaryKey: true,
        autoIncrement: true,
        allowNull: false,
        comment: '留言墙id'
      },
      username: {
        type: STRING(20),
        allowNull: false,
        comment: '留言墙用户名'
      },
      message: {
        type: TEXT,
        allowNull: false,
        comment: '留言墙内容'
      },
      color_type: {
        type: INTEGER(20),
        allowNull: false,
        defaultValue: 1,
        comment: '留言墙颜色类型'
      },
      tag: {
        type: STRING(20),
        allowNull: false,
        comment: '留言墙标签'
      },
      status: {
        type: BOOLEAN,
        allowNull: false,
        defaultValue: 1,
        comment: '留言墙状态'
      },
      created_at: DATE,
      updated_at: DATE
    })
  },

  async down(queryInterface) {
    queryInterface.dropTable('works')
  }
}
